﻿IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'PRC_TB_ALERTS_TASKS_CATEGORIES_SE')
	BEGIN
		DROP  Procedure  dbo.PRC_TB_ALERTS_TASKS_CATEGORIES_SE
	END

GO

CREATE Procedure dbo.PRC_TB_ALERTS_TASKS_CATEGORIES_SE
	(
		@TAT_ID int
	)

AS

select
	TC_ID,
	TC_DESCRIPTION
from TB_ALERTS_TASKS_CATEGORIES
	inner join TB_CATEGORIES
		on TATC_CATEGORY_ID = TC_ID
where TATC_ALERT_TASK_ID = @TAT_ID
order by TC_DESCRIPTION

GO

GRANT EXEC ON dbo.PRC_TB_ALERTS_TASKS_CATEGORIES_SE TO PUBLIC

GO

